package com.ruoyi.system.service;


import com.ruoyi.common.core.domain.dto.SysOrderDto;
import com.ruoyi.common.core.domain.entity.system.SysJishiOrder;
import com.ruoyi.common.core.domain.entity.system.SysOrder;
import com.ruoyi.common.core.domain.entity.system.SysPintuanParentOrder;
import com.ruoyi.common.core.domain.entity.system.SysTaocanOrder;
import com.ruoyi.common.core.domain.model.CreatePintuanOrderReqBody;
import org.springframework.dao.DuplicateKeyException;

import java.util.List;
import java.util.Map;

/**
 * 小程序订单Service接口
 *
 * @author zjw
 * @date 2023-08-08
 */
public interface ISysOrderService {
    /**
     * 查询小程序订单
     *
     * @param orderNo 小程序订单主键
     * @return 小程序订单
     */
    public SysOrder selectSysOrderByOutOrderNo(String orderNo);

    /**
     * 查询小程序订单列表
     *
     * @param sysOrder 小程序订单
     * @return 小程序订单集合
     */
    public List<SysOrder> selectSysOrderList(SysOrder sysOrder);

    /**
     * 新增小程序订单
     *
     * @param sysOrder 小程序订单
     * @return 结果
     */
    public int insertSysOrder(SysOrder sysOrder);

    /**
     * 修改小程序订单
     *
     * @param sysOrder 小程序订单
     * @return 结果
     */
    public int updateSysOrder(SysOrder sysOrder);

    /**
     * 批量删除小程序订单
     *
     * @param orderNos 需要删除的小程序订单主键集合
     * @return 结果
     */
    public int deleteSysOrderByOrderNos(String[] orderNos);

    /**
     * 删除小程序订单信息
     *
     * @param orderNo 小程序订单主键
     * @return 结果
     */
    public int deleteSysOrderByOrderNo(String orderNo);

    Map<String, Object> queryPayStatus(String outOrderNo);

    Map<String, Object> queryRefundStatus(String outRefundNo, int refundType);

    SysOrderDto queryOrder(String outOrderNo);

    List<SysOrderDto> queryAllOrderByUserId(Long userId);

    List<SysOrderDto> queryUnpaidOrder(Long userId);

    List<SysOrderDto> queryToUseOrder(Long userId);

    List<SysOrderDto> queryUsingOrder(Long userId);

    List<SysOrderDto> queryFulfilledOrder(Long userId);

    Map<String, Object> createJishiOrder(SysJishiOrder sysJishiOrder) throws Exception;

    Map<String, Object> createTaocanOrder(SysTaocanOrder taocanOrder) throws Exception;

    Map<String, Object> createPintuanOrder(CreatePintuanOrderReqBody reqBody);

    void mockUnlockAndUsingForPintuanOrder(SysPintuanParentOrder sysPintuanParentOrder, Long unlockDelayTime, Long mockUsingTime);

    void closeOrder(int orderType, String orderId);

    void stopOrder(int orderType, String orderId);
}
